#include "basewidget.h"

#include <QScrollArea>
#include <QHBoxLayout>
#include <QEvent>

BaseWidget::BaseWidget(QWidget* parent) : UWidget(parent)
{
    setBackgroundRole(QPalette::Base);
    setRadius(8);

    area = new QScrollArea(this);
    area->setFrameShape(QFrame::NoFrame);
    QVBoxLayout *layout = new QVBoxLayout;
    area->setWidgetResizable(true);
    layout->addWidget(area);
    setLayout(layout);
}

BaseWidget::~BaseWidget()
{
}

void BaseWidget::init()
{
    initUI();
    initConnection();
    initData();
}

void BaseWidget::setWidget(QWidget *widget)
{
    area->setWidget(widget);
}

void BaseWidget::initData()
{
}

void BaseWidget::updateLanguage()
{
}

void BaseWidget::changeEvent(QEvent *event)
{
    if (event->type() == QEvent::LanguageChange)
    {
        updateLanguage();
    }
    else
    {
        UWidget::changeEvent(event);
    }
}

